package com.example.demo.repository;

import com.example.demo.entity.Bookkeeping;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;

public interface BookkeepingRepository extends JpaRepository<Bookkeeping, Integer> {
    List<Bookkeeping> findByUserIdAndYearAndMonthOrderByBookDateDesc(Integer userId, int year, int month);

    // 新增方法：根据用户ID查询所有记账记录，按记账日期降序排序
    List<Bookkeeping> findByUserIdOrderByBookDateDesc(Integer userId);
}
